# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gcr
pkgver=3.41.0
pkgrel=0
pkgdesc="library for bits of crypto UI and parsing"
url="https://wiki.gnome.org/Projects/CryptoGlue"
arch="all"
license="LGPL-2.0-or-later"
makedepends="
	glib-dev
	gobject-introspection-dev
	gtk+3.0-dev
	libgcrypt-dev
	libsecret-dev
	libxslt
	meson gtk-doc
	openssh-client
	p11-kit-dev
	vala
	"
checkdepends="xvfb-run dbus-x11"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-lang
	$pkgname-base
	"
source="https://download.gnome.org/sources/gcr/${pkgver%.*}/gcr-$pkgver.tar.xz
	fix-build-without-systemd.patch
	fix-meson-invalid-kw-argument.patch
	dont-run-gpg-tests.patch
	fix-64-bit-time_t-32-bit.patch
	"
options="!check"  # testsuite requires community/xvfb-run

build() {
	abuild-meson \
		-Dgpg_path=/usr/bin/gpg2 \
		-Dsystemd=disabled \
		output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	xvfb-run meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

base() {
	pkgdesc="$pkgdesc (base libraries)"
	depends=""

	amove usr/lib/libgck-1.so.*
	amove usr/lib/libgcr-base-3.so.*
}

sha512sums="
455acc40ed77feeb35f9845b00229f468b322b7eda0b1b5abb0153f0a6ba29f3d0364df22225143f4caf130254a1258b3c7f934370e5142f2f64e1c3084b6f6e  gcr-3.41.0.tar.xz
29827b87272c152d98a131ab328b8711223b1d13f5057476cfdee295a46d8a4f49daf3081d67b3a59cb48700329baf2ea49b0742b4b619afb2e6d01ce785f186  fix-build-without-systemd.patch
939e49b23747989a532cc41be6cd6d504e88f69852897f15419f3109a1b799edd7dabe9e1e98d2582dd78de6530109c101b7e0b754fc8d3a07f098dca0c6ce0d  fix-meson-invalid-kw-argument.patch
e4fc2248497e7103980e9baf9444505649ee93c657c7a82c042ae62d7c54b2764ad7bc9780467ceda5e53a23fa11dc4957898929c7d7f995d9d0d205d18d5eb7  dont-run-gpg-tests.patch
579b229d6f310ed035974a92a65804deae7b047cf6109e259844ecdc75df32653a2c9f9dcddba9092da335f44d07d5d82056ae0cf5775057bdb9be5b52e29bcc  fix-64-bit-time_t-32-bit.patch
"
